<template>

    <div>
        <van-nav-bar fixed="true" title="案例详情" left-text="返回" @click-left="onClickLeft" left-arrow>
            <template #right>
                <van-icon name="search" size="18"/>
            </template>
        </van-nav-bar>

        <div style="margin-top: 46px">
            <div :key="item.id" v-for="item in caseLists">
                <van-cell is-link @click="showPopup">{{item.lawCaseName}}</van-cell>
                <van-popup v-model="show" closeable="true" position="bottom" style="height: 700vh">
                    <van-cell style="margin-top: 46px">现场图</van-cell>
                    <van-cell><img width="100%" :src="item.lawCaseImage"></van-cell>
                    <van-cell>标题：{{item.lawCaseTitle}}</van-cell>
                    <van-cell>详细内容：{{item.lawCaseContent}}</van-cell>
                </van-popup>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        name: "caseList",
        data() {
            return {
                show: false,
                caseLists: []
            };
        },
        methods: {
            showPopup() {
                this.show = true;
            },
            onClickLeft() {
                this.$router.push({path: 'home'})
            },
            caseList() {
                if (this.$route.query.id == 1) {
                    this.$axios.post('/case/getCaseList', {"lawCaseKind": "行政案例"}, res => {
                        console.log(res)
                        this.caseLists = res.data.data
                    })
                } else if (this.$route.query.id == 2) {
                    this.$axios.post('/case/getCaseList', {"lawCaseKind": "经济案例"}, res => {
                        console.log(res)
                        this.caseLists = res.data.data
                    })
                } else if (this.$route.query.id == 3) {
                    this.$axios.post('/case/getCaseList', {"lawCaseKind": "民事案例"}, res => {
                        console.log(res)
                        this.caseLists = res.data.data
                    })
                } else if (this.$route.query.id == 4) {
                    this.$axios.post('/case/getCaseList', {"lawCaseKind": "刑事案例"}, res => {
                        console.log(res)
                        this.caseLists = res.data.data
                    })
                }
            }
        },
        created() {
            this.caseList()
        }
    }
</script>


<style scoped>


</style>
